package com.umeox.watch.audiobooks.utils

import android.content.res.AssetManager
import com.umeox.moto.common.utils.AppUtils
import java.io.BufferedReader
import java.io.File
import java.io.IOException
import java.io.InputStreamReader


 fun getDataFromJson(fileName: String): String {
    val stringBuffer = StringBuffer()
    try {
        val assetsManager: AssetManager = AppUtils.getApp().assets
        val bufferedReader =
            BufferedReader(InputStreamReader(assetsManager.open("json" + File.separator +fileName)))
        var line: String?
        while (bufferedReader.readLine().also { line = it } != null) {
            stringBuffer.append(line)
        }
    } catch (e: IOException) {
        e.printStackTrace()
    }
    return stringBuffer.toString()
}
